﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Spaanjaars.ContactManager.Services.Interfaces;
using Spaanjaars.ContactManager.Services.Queries;
using Spaanjaars.ContactManager.UX.MVC.ViewModels;

namespace Spaanjaars.ContactManager.UX.MVC.Controllers
{
    public class ContactPersonListController : Controller
    {
        private readonly IContactPersonSearchService _contactPersonSearchService;

        public ContactPersonListController(IContactPersonSearchService contactPersonSearchService)
        {
            _contactPersonSearchService = contactPersonSearchService;
        }

        //
        // GET: /ContactPersonList/

        public ActionResult Index()
        {
            var contactPersonListViewModel = new ContactPersonListViewModel
                                                 {
                                                     ContactPersons = _contactPersonSearchService.FindPeople(new FindPeopleQuery() { PageCount = 10, PageIndex = 1, LoadContactPersonAddresses = false }),
                                                     Page = 1
                                                 };

            return View(contactPersonListViewModel);
        }

    }
}
